home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / rpcgen.z / rpcgen
Text File  |  1998-10-20  |  17KB  |  331 lines

  1.  
  2.  
  3.  
  4. rrrrppppccccggggeeeennnn((((1111))))                                                            rrrrppppccccggggeeeennnn((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _rrrr_pppp_cccc_gggg_eeee_nnnn - an RPC protocol compiler
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _rrrr_pppp_cccc_gggg_eeee_nnnn _i_n_f_i_l_e
  13.      _rrrr_pppp_cccc_gggg_eeee_nnnn _[[[[_----_CCCC _c_p_p_c_m_d_]]]] _[[[[_----_DDDD_n_a_m_e_[[[[_====_v_a_l_u_e_]]]]_]]]] _[[[[_----_TTTT_]]]] _[[[[_----_PPPP_]]]] _[[[[_----_IIII _|||| _----_KKKK _s_e_c_s_]]]] _i_n_f_i_l_e
  14.      _rrrr_pppp_cccc_gggg_eeee_nnnn _----_cccc_||||_----_hhhh_||||_----_llll_||||_----_mmmm_||||_----_tttt _[[[[_----_PPPP_]]]] _[[[[_----_oooo _o_u_t_f_i_l_e _]]]] _i_n_f_i_l_e
  15.      _rrrr_pppp_cccc_gggg_eeee_nnnn _----_ssss _n_e_t_t_y_p_e _[[[[_----_oooo _o_u_t_f_i_l_e_]]]] _i_n_f_i_l_e
  16.      _rrrr_pppp_cccc_gggg_eeee_nnnn _----_nnnn _n_e_t_i_d _[[[[_----_oooo _o_u_t_f_i_l_e_]]]] _i_n_f_i_l_e
  17.  
  18. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      _rrrr_pppp_cccc_gggg_eeee_nnnn is a tool that generates C code to implement an RPC protocol.
  20.      _rrrr_pppp_cccc_gggg_eeee_nnnn will produce file to be used with libc [see _iiii_nnnn_tttt_rrrr_oooo_...._3333_nnnn(1)].  To
  21.      produce file to be used with libnsl see _rrrr_pppp_cccc_gggg_eeee_nnnn______tttt_llll_iiii(1).  The input to
  22.      _rrrr_pppp_cccc_gggg_eeee_nnnn is a language similar to C known as RPC Language (Remote Procedure
  23.      Call Language).
  24.  
  25.      _rrrr_pppp_cccc_gggg_eeee_nnnn is normally used as in the first synopsis where it takes an input
  26.      file and generates up to four output files.  If the _i_n_f_i_l_e is named
  27.      _pppp_rrrr_oooo_tttt_oooo_...._xxxx, then _rrrr_pppp_cccc_gggg_eeee_nnnn will generate a header file in _pppp_rrrr_oooo_tttt_oooo_...._hhhh, XDR routines
  28.      in _pppp_rrrr_oooo_tttt_oooo______xxxx_dddd_rrrr_...._cccc, server-side stubs in _pppp_rrrr_oooo_tttt_oooo______ssss_vvvv_cccc_...._cccc, and client-side stubs
  29.      in _pppp_rrrr_oooo_tttt_oooo______cccc_llll_nnnn_tttt_...._cccc.  With the _----_TTTT option, it will also generate the RPC
  30.      dispatch table in _pppp_rrrr_oooo_tttt_oooo______tttt_bbbb_llll_...._iiii.
  31.  
  32.      The server created can be started both by the port monitors (for example,
  33.      _iiii_nnnn_eeee_tttt_dddd or _llll_iiii_ssss_tttt_eeee_nnnn) or by itself.  When it is started by a port monitor, it
  34.      creates servers only for the transport for which the file descriptor _0000
  35.      was passed.  The name of the transport must be specified by setting up
  36.      the environment variable _PPPP_MMMM______TTTT_RRRR_AAAA_NNNN_SSSS_PPPP_OOOO_RRRR_TTTT.  When the server generated by
  37.      _rrrr_pppp_cccc_gggg_eeee_nnnn is executed, it creates server handles for all the transports
  38.      specified in _NNNN_EEEE_TTTT_PPPP_AAAA_TTTT_HHHH environment variable, or if it is not set, it
  39.      creates server handles for all the visible transports from _////_eeee_tttt_cccc_////_nnnn_eeee_tttt_cccc_oooo_nnnn_ffff_iiii_gggg
  40.      file.  Note:  the transports are chosen at run time and not at compile
  41.      time.  When the server is self-started, it backgrounds itself by default.
  42.      A special symbol, _RRRR_PPPP_CCCC______SSSS_VVVV_CCCC______FFFF_GGGG, can be defined at compilation time to make
  43.      the server process run in foreground.
  44.  
  45.      The second synopsis provides special features which allow for the
  46.      creation of more sophisticated RPC servers.  These features include
  47.      support for user provided _####_dddd_eeee_ffff_iiii_nnnn_eeee_ssss and RPC dispatch tables.  The entries
  48.      in the RPC dispatch table contain:
  49.           +o  pointers to the service routine corresponding to that procedure,
  50.           +o  a pointer to the input and output arguments
  51.           +o  the size of these routines
  52.      A server can use the dispatch table to check authorization and then to
  53.      execute the service routine; a client library may use it to deal with the
  54.      details of storage management and XDR data conversion.
  55.  
  56.      The other three synopses shown above are used when one does not want to
  57.      generate all the output files, but only a particular one.  Some examples
  58.      of their usage is described in the EXAMPLE section below.  When _rrrr_pppp_cccc_gggg_eeee_nnnn is
  59.      executed with the _----_ssss option, it creates servers for that particular class
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. rrrrppppccccggggeeeennnn((((1111))))                                                            rrrrppppccccggggeeeennnn((((1111))))
  71.  
  72.  
  73.  
  74.      of transports.  When executed with the _----_nnnn option, it creates a server for
  75.      the transport specified by _n_e_t_i_d.  If _i_n_f_i_l_e is not specified, _rrrr_pppp_cccc_gggg_eeee_nnnn
  76.      accepts the standard input.
  77.  
  78.      The C preprocessor, _cccc_cccc _----_EEEE [see _cccc_cccc(1)], is run on the input file before it
  79.      is actually interpreted by _rrrr_pppp_cccc_gggg_eeee_nnnn.  For each type of output file, _rrrr_pppp_cccc_gggg_eeee_nnnn
  80.      defines a special preprocessor symbol for use by the _rrrr_pppp_cccc_gggg_eeee_nnnn programmer:
  81.  
  82.      _RRRR_PPPP_CCCC______HHHH_DDDD_RRRR     defined when compiling into header files
  83.      _RRRR_PPPP_CCCC______XXXX_DDDD_RRRR     defined when compiling into XDR routines
  84.      _RRRR_PPPP_CCCC______SSSS_VVVV_CCCC     defined when compiling into server-side stubs
  85.      _RRRR_PPPP_CCCC______CCCC_LLLL_NNNN_TTTT    defined when compiling into client-side stubs
  86.      _RRRR_PPPP_CCCC______TTTT_BBBB_LLLL     defined when compiling into RPC dispatch tables
  87.  
  88.      Any line beginning with `_%%%%' is passed directly into the output file,
  89.      uninterpreted by _rrrr_pppp_cccc_gggg_eeee_nnnn.
  90.  
  91.      For every data type referred to in _i_n_f_i_l_e, _rrrr_pppp_cccc_gggg_eeee_nnnn assumes that there
  92.      exists a routine with the string _xxxx_dddd_rrrr_____ prepended to the name of the data
  93.      type.  If this routine does not exist in the RPC/XDR library, it must be
  94.      provided.  Providing an undefined data type allows customization of XDR
  95.      routines.
  96.  
  97.      The following options are available:
  98.  
  99.      _----_CCCC _c_p_p_c_m_d
  100.           Run the preprocessor command, _c_p_p_c_m_d, instead of the default, cpp.
  101.  
  102.      _----_cccc   Compile into XDR routines.
  103.  
  104.      _----_DDDD_n_a_m_e_[[[[_====_v_a_l_u_e_]]]]
  105.           Define a symbol _n_a_m_e.  Equivalent to the _####_dddd_eeee_ffff_iiii_nnnn_eeee directive in the
  106.           source.  If no _v_a_l_u_e is given, _v_a_l_u_e is defined as _1111.  This option
  107.           may be specified more than once.
  108.  
  109.      _----_hhhh   Compile into _CCCC data-definitions (a header file).  The _----_TTTT option can
  110.           be used in conjunction to produce a header file which supports RPC
  111.           dispatch tables.
  112.  
  113.      _----_IIII   Compile support for _iiii_nnnn_eeee_tttt_dddd(1M) in the server side stubs.  Such
  114.           servers can be self-started or can be started by _iiii_nnnn_eeee_tttt_dddd.  When the
  115.           server is self-started, it backgrounds itself by default.  A special
  116.           define symbol _RRRR_PPPP_CCCC______SSSS_VVVV_CCCC______FFFF_GGGG can be used to run the server process in
  117.           foreground, or the user may simply compile without the _----_IIII option.
  118.  
  119.           If there are no pending client requests, the _iiii_nnnn_eeee_tttt_dddd servers exit
  120.           after 120 seconds (default).  The default can be changed with the _----_KKKK
  121.           option.  All the error messages for _iiii_nnnn_eeee_tttt_dddd servers are always logged
  122.           with _ssss_yyyy_ssss_llll_oooo_gggg(3).
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. rrrrppppccccggggeeeennnn((((1111))))                                                            rrrrppppccccggggeeeennnn((((1111))))
  137.  
  138.  
  139.  
  140.           Note:  this option is supported for backward compatibility only.  By
  141.           default, _rrrr_pppp_cccc_gggg_eeee_nnnn generates servers that can be invoked through
  142.           portmonitors.
  143.  
  144.      _----_KKKK _s_e_c_s
  145.           By default, services created using _rrrr_pppp_cccc_gggg_eeee_nnnn wait _1111_2222_0000 seconds after
  146.           servicing a request before exiting.  That interval can be changed
  147.           using the _----_KKKK flag.  To create a server that exits immediately upon
  148.           servicing a request, _----_KKKK _0000 can be used.  To create a server that
  149.           never exits, the appropriate argument is _----_KKKK _----_1111.
  150.  
  151.           When monitoring for a server, some portmonitors, like _llll_iiii_ssss_tttt_eeee_nnnn(1M),
  152.           _a_l_w_a_y_s spawn a new process in response to a service request.  If it
  153.           is known that a server will be used with such a monitor, the server
  154.           should exit immediately on completion.  For such servers, _rrrr_pppp_cccc_gggg_eeee_nnnn
  155.           should be used with _----_KKKK _----_1111.
  156.  
  157.      _----_llll   Compile into client-side stubs.
  158.  
  159.      _----_mmmm   Compile into server-side stubs, but do not generate a main routine.
  160.           This option is useful for doing callback-routines and for users who
  161.           need to write their own main routine to do initialization.
  162.  
  163.      _----_nnnn _n_e_t_i_d
  164.           Compile into server-side stubs for the transport specified by _n_e_t_i_d.
  165.           There should be an entry for _n_e_t_i_d in the netconfig database.  This
  166.           option may be specified more than once, so as to compile a server
  167.           that serves multiple transports.
  168.  
  169.      _----_oooo _o_u_t_f_i_l_e
  170.           Specify the name of the output file.  If none is specified, standard
  171.           output is used (_----_cccc, _----_hhhh, _----_llll, _----_mmmm, _----_nnnn, _----_ssss and _----_tttt modes only).
  172.  
  173.      _----_PPPP   Generate prototyped XDR and stub function declarations and
  174.           definitions suitable for ANSI C and C++. The prototypes for the
  175.           client- and server-side stubs are different; their declarations in
  176.           the generated header file are conditionally-compiled with the values
  177.           _RPCGEN_CLNT or _RPCGEN_SVC.  If you write your own client or server
  178.           code, you must define the appropriate value in your source files
  179.           before including the generated header file. Using the example above,
  180.           the file for client code should use:
  181.  
  182.                #define _RPCGEN_CLNT
  183.                #include "proto.h"
  184.  
  185.           and the file for server code should use:
  186.  
  187.                #define _RPCGEN_SVC
  188.                #include "proto.h"
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. rrrrppppccccggggeeeennnn((((1111))))                                                            rrrrppppccccggggeeeennnn((((1111))))
  203.  
  204.  
  205.  
  206.      _----_ssss _n_e_t_t_y_p_e
  207.           Compile into server-side stubs for all the transports belonging to
  208.           the class _n_e_t_t_y_p_e.  The supported classes are _nnnn_eeee_tttt_pppp_aaaa_tttt_hhhh, _vvvv_iiii_ssss_iiii_bbbb_llll_eeee,
  209.           _cccc_iiii_rrrr_cccc_uuuu_iiii_tttt______nnnn, _cccc_iiii_rrrr_cccc_uuuu_iiii_tttt______vvvv, _dddd_aaaa_tttt_aaaa_gggg_rrrr_aaaa_mmmm______nnnn, _dddd_aaaa_tttt_aaaa_gggg_rrrr_aaaa_mmmm______vvvv, _tttt_cccc_pppp, and _uuuu_dddd_pppp [see
  210.           _rrrr_pppp_cccc(3N) for the meanings associated with these classes].  This
  211.           option may be specified more than once.  Note:  the transports are
  212.           chosen at run time and not at compile time.
  213.  
  214.      _----_tttt   Compile into RPC dispatch table.
  215.  
  216.      _----_TTTT   Generate the code to support RPC dispatch tables.
  217.  
  218.      The options _----_cccc, _----_hhhh, _----_llll, _----_mmmm, _----_ssss and _----_tttt are used exclusively to generate a
  219.      particular type of file, while the options _----_DDDD, _----_PPPP, and _----_TTTT are global and
  220.      can be used with the other options.
  221.  
  222. NNNNOOOOTTTTEEEESSSS
  223.      The RPC Language does not support nesting of structures.  As a work-
  224.      around, structures can be declared at the top-level, and their name used
  225.      inside other structures in order to achieve the same effect.
  226.  
  227.      Name clashes can occur when using program definitions, since the apparent
  228.      scoping does not really apply.  Most of these can be avoided by giving
  229.      unique names for programs, versions, procedures and types.
  230.  
  231.      The server code generated with _----_nnnn option refers to the transport
  232.      indicated by _n_e_t_i_d and hence is very site specific.
  233.  
  234. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  235.      The following example:
  236.  
  237.           rpcgen -T prot.x
  238.  
  239.      generates all the five files:  _pppp_rrrr_oooo_tttt_...._hhhh, _pppp_rrrr_oooo_tttt______cccc_llll_nnnn_tttt_...._cccc, _pppp_rrrr_oooo_tttt______ssss_vvvv_cccc_...._cccc,
  240.      _pppp_rrrr_oooo_tttt______xxxx_dddd_rrrr_...._cccc and _pppp_rrrr_oooo_tttt______tttt_bbbb_llll_...._iiii.
  241.  
  242.      The following example sends the C data-definitions (header file) to the
  243.      standard output.
  244.  
  245.           rpcgen -h prot.x
  246.  
  247.      To send the test version of the _----_DDDD_TTTT_EEEE_SSSS_TTTT, server side stubs for all the
  248.      transport belonging to the class _dddd_aaaa_tttt_aaaa_gggg_rrrr_aaaa_mmmm______nnnn to standard output, use:
  249.  
  250.           rpcgen -s datagram_n -DTEST prot.x
  251.  
  252.      To create the server side stubs for the transport indicated by _n_e_t_i_d _tttt_cccc_pppp,
  253.      use:
  254.  
  255.           rpcgen -n tcp -o prot_svc.c prot.x
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. rrrrppppccccggggeeeennnn((((1111))))                                                            rrrrppppccccggggeeeennnn((((1111))))
  269.  
  270.  
  271.  
  272. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  273.      _cccc_cccc(1), _rrrr_pppp_gggg_eeee_nnnn______tttt_llll_iiii(1)
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.